package com.jiinfo.interceptor;

import java.util.Date;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.kit.PropKit;
import com.jiinfo.util.DateUtils;

public class CommonInterceptor implements Interceptor{

	@Override
	public void intercept(Invocation inv) {
		
		Date now=new Date();
		inv.getController().setAttr("path", PropKit.get("host.path"));
		inv.getController().setAttr("basePath", PropKit.get("host.basePath"));
		inv.getController().setAttr("today", now);
		inv.getController().setAttr("todayString", DateUtils.format(now));
		inv.getController().setAttr("nowString", DateUtils.format(now,"yyyy-MM-dd HH:mm:ss"));
		
		inv.invoke();
	}

}
